package cn.edu.zzuli.message.config;

import cn.edu.zzuli.model.entity.WebMessage;
import com.alibaba.fastjson.JSON;

import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

public class WebSocketCustomEncoding implements Encoder.Text<WebMessage> {
    @Override
    public String encode(WebMessage webMessage) {
        assert webMessage!=null;
        return JSON.toJSONString(webMessage);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}
